package com.yape.stockService.impl;

import com.yape.dao.ISectorFundFlowDao;
import com.yape.po.SectorFundFlow;
import com.yape.stockService.ISectorFundFlowService;
import com.yape.vo.SectorFundFlowVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zmele
 * @description
 * @date 2025/5/25 15:15
 */
@Service
public class SectorFundFlowService implements ISectorFundFlowService {

    @Resource
    private ISectorFundFlowDao sectorFundFlowDao;

    @Override
    public List<SectorFundFlowVO> querySectorFoundFlow(){
        List<SectorFundFlow> sectorFundFlows = sectorFundFlowDao.querySectorFundFlow();

        List<SectorFundFlowVO> sectorFundFlowVOList = sectorFundFlows.stream()
                .map(e -> SectorFundFlowVO.builder()
                        .id(e.getId())
                        .sectorName(e.getSectorName())
                        .dailyChangePercent(e.getDailyChangePercent())
                        .build())
                .toList();

        return sectorFundFlowVOList;
    }
}